package com.example.framework.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;

public class HelleProxy implements InvocationHandler {

    public Object getInstance(Class targetClz){
       return Proxy.newProxyInstance(targetClz.getClassLoader(),new Class[]{targetClz},this);
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(method.getName()+":"+ Arrays.asList(args));
        String hello = "say-->"+args[0];
        return hello;
    }
}
